package com.example.administrator.musicplay;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;

/**
 * Created by Administrator on 2018/5/31.
 */

public class simpleplay extends Activity{
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_musicplay);
        Button button1=(Button)findViewById(R.id.btn_start_play);
        button1.setOnClickListener(stopIt);
        Button button2=(Button)findViewById(R.id.btn_stop_play);
        button2.setOnClickListener(stopIt);
    }
    private OnClickListener startIt =new OnClickListener() {

        public void onClick(View v) {
            startService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
        }
    };
    private OnClickListener stopIt =(v) → {
        stopService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
        finish();
    }
}
